﻿@model DslamPort.Models.UserModel
<div class="container_12">       
    <div class="grid_12">            
        <div class="module">
                <h2 align="right"><span><a href="@Url.Action("Index", "User")">Quay lại</a></span></h2>                       
                <div class="module-body">
                @using (Html.BeginForm("AddUser", "User", FormMethod.Post, new { id = "AddUser" }))
                {                      
                    <div align="center"><h3>Thêm mới người dùng</h3>
                        <div class="account" align="center"> 
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/Add_User.png")" width="12%" />
                        </div>
                    </div>
                    if (TempData["msg"] != null)
                    {                            
                        <span class="notification n-error">@TempData["msg"]</span>
                    }  
                    <p></p>
                    <table> 
                        <div style="width:50%; text-align:center; float:left">      
                        <p align="center">
                            <label style="width:53%; text-align:left">Tên đăng nhập:</label>
                                <div class="tendangnhap" align="center" style="padding-left: 10px; width: 100%">
                                    @Html.TextBoxFor(model => model.user_name, new { @name = "user_name", @class = "input-medium" }) 
                                    <font color="red">(*)</font>
                                    <label style="width:57%; text-align:left">
                                    @Html.ValidationMessageFor(model => model.user_name)
                                    </label>
                                </div>                                                
                        </p>        
                        <p align="center">
                            <label style="width:53%; text-align:left">Mật khẩu:</label>
                            <div class="tendangnhap" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.password, new { @name = "password", @class = "input-medium" })
                                <font color="red">(*)</font>
                                <label style="width:57%; text-align:left">@Html.ValidationMessageFor(model => model.password)
                                </label>
                            </div>
                        </p>    
                        <p align="center">
                            <label style="width:53%; text-align:left">Đơn vị:</label>  
                            @if (ViewBag.donvi != null)
                            {                               
                                @Html.DropDownList("quan_huyen_id", ViewBag.donvi as SelectList, "---Chọn đơn vị---")                               
                            }                      
                        </p>
                        
                        </div>
                        <div style="width:50%; text-align:center; float:left">
                        <p align="center">
                            <label style="width:53%; text-align:left">Trạng thái:</label>
                            <select name="status">
                                <option value="1" selected="selected">Bình thường</option>
                                <option value="0" >Khóa</option>                            
                            </select>
                        </p>
                        <p align="center">
                            <label style="width:53%; text-align:left">Họ tên:</label>
                            @Html.TextBoxFor(model => model.ho_ten, new { @name = "ho_ten", @class = "input-medium" })
                        </p>
                        
                        </div>
                    </table>
                    <div class="button" align="center">
                        <p style="width:26%; text-align:center">
                            <input class="submit-green" type="submit" value="Thêm"/> 
                            <input class="submit-gray" type="reset" value="Hủy" />
                            @*<input class="submit-gray" type="button"  onclick="location.href='@Url.Action("Index", "User")'" value="Quay lại" />*@
                        </p>
                    </div>
                }
                </div> <!-- End .module-body -->
        </div>  <!-- End .module -->
        <div style="clear:both;"></div>
    </div> <!-- End .grid_12 --> 
    <div style="clear:both;"></div>
</div> <!-- End .container_12 -->
@*<script type="text/javascript">
    $("#main_stations_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getStationsJson", "User")',
            data: { MainStationId: $("#main_stations_id > option:selected").attr("value"), Order: "name" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn nhà trạm---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#stations_id").html(items.join(' '));
            }
        })
    });
</script>*@